package org.sabeot.enlistme.hibernate.dto;

import java.util.Calendar;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name="users")
public class UserDTO extends BasicDTO {

	@Column(name = "login", nullable = false, unique = true)
	private String login;

	@Column(name = "email", nullable = false, unique = true)
	private String email;

	@Column(name = "first_name", nullable = true)
	private String firstName;

	@Column(name = "last_name", nullable = true)
	private String lastName;

	@Column(name = "active", nullable = false)
	private boolean active;

	public UserDTO() {
	}

	public UserDTO(String login, String email) {
		Date currentDate = Calendar.getInstance().getTime();

		this.login = login;
		this.email = email;
		this.active = false;
		this.firstName = null;
		this.lastName = null;
		this.createDate = currentDate;
		this.modifyDate = currentDate;
	}

	public UserDTO(String login, String email, boolean active) {
		Date currentDate = Calendar.getInstance().getTime();

		this.login = login;
		this.email = email;
		this.active = active;
		this.firstName = null;
		this.lastName = null;
		this.createDate = currentDate;
		this.modifyDate = currentDate;

	}

	/*
	 * Getters and setters
	 */
	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

}
